<template>
  <div id="app">
    <textarea :value="input" @input="update"></textarea>
    <div v-html="compiledMarkdown" class="markdown-body"></div>
  </div>
</template>

<script>
export default {
  name: 'app',
  data () {
    return {
        input:window.demoMD,
      msg: 'Welcome to Your Vue.js App'
    }
  },

        computed: {
          compiledMarkdown: function() {
            setTimeout(()=>{
                    MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
            },500)
            return markdown.render(this.input)
          }
        },

    methods: {
        update: _.debounce(function(e) {
        this.input = e.target.value;
        }, 300)
    }

}
</script>

<style>
html, body {

    height:100%;
}
#app {
    display:flex;
    height:100%;
    width:100%;
}
#app > textarea,#app>div {
flex: 1;
}
#app > textarea {
  border: none;
  border-right: 1px solid #ccc;
  resize: none;
  outline: none;
  background-color: #f6f6f6;
  font-size: 14px;
  font-family: "Monaco", courier, monospace;
  padding: 20px;
}
textarea,
#app > div {
  display: inline-block;
  width: 49%;
  height: 100%;
  vertical-align: top;
  box-sizing: border-box;
  padding: 0 20px;
}

</style>
